<template>
  <div>
    <el-tabs type="border-card" v-model="active" style="min-height: 200px">
      <el-tab-pane name="load">
        <div slot="label">
          贷款记录
          <span class="badge badge-info">{{ loadCount }}</span>
        </div>
        <customer-file-tab-load :data="data" @count="setCount"></customer-file-tab-load>
      </el-tab-pane>
      <el-tab-pane label="评分(评级)记录">
        <customer-file-tab-score></customer-file-tab-score>
      </el-tab-pane>
      <el-tab-pane label="纳税信用等级记录" v-if="isCompany">
        <customer-file-tab-grade></customer-file-tab-grade>
      </el-tab-pane>
      <el-tab-pane label="工商信息" v-if="isCompany">
        <customer-file-tab-ic :data="data"></customer-file-tab-ic>
      </el-tab-pane>
      <el-tab-pane label="法院被执行记录">
        <div class="p-3">暂无 {{ data.customer_name }} 的相关法院被执行记录</div>
      </el-tab-pane>
      <el-tab-pane label="涉农保险">
        <customer-file-tab-insurance :data="data"></customer-file-tab-insurance>
      </el-tab-pane>
      <el-tab-pane label="政策补贴">
        <customer-file-tab-subsidy :data="data"></customer-file-tab-subsidy>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import CustomerFileTabLoad from '@/credit/views/city/customer/CustomerFileTabLoad'
import CustomerFileTabScore from '@/credit/views/city/customer/CustomerFileTabScore'
import CustomerFileTabGrade from '@/credit/views/city/customer/CustomerFileTabGrade'
import CustomerFileTabIc from '@/credit/views/city/customer/CustomerFileTabIc'
import CustomerFileTabInsurance from '@/credit/views/city/customer/CustomerFileTabInsurance'
import CustomerFileTabSubsidy from '@/credit/views/city/customer/CustomerFileTabSubsidy'
export default {
  components: {
    CustomerFileTabLoad,
    CustomerFileTabScore,
    CustomerFileTabGrade,
    CustomerFileTabIc,
    CustomerFileTabInsurance,
    CustomerFileTabSubsidy,
  },
  props: {
    data: {
      type: Object,
      default: () => ({}),
    },
  },
  data() {
    return {
      active: 'load',
      loadCount: 0,
    }
  },

  computed: {
    isCompany() {
      return +this.data.customer_type === 1
    },
  },

  // watch: {
  //   data: {
  //     handler: function () {
  //       this.active = 'load'
  //     },
  //     deep: true,
  //     immediate: true
  //   }
  // },

  created() {},
  methods: {
    setCount(num) {
      this.loadCount = num
    },
  },
}
</script>
<style lang="scss" scoped></style>
